home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_300
/
355_02
/
slk2.exe
/
SPP
/
GLB.H
< prev
next >
Wrap
C/C++ Source or Header
|
1991-06-09
|
6KB
|
195 lines
/*
New SPP -- global header for variables.
Source: glb.h
Started: June 20, 1986
Version:
July 15, 1988;
June 22, 1989:
o MAX_PATHS increased to 40.
o curly_ok_flag added.
Version 1.4A: July 28, 1989
o slc_flag added
PUBLIC DOMAIN SOFTWARE
Sherlock, including the SPP, SDEL and SDIF programs, was placed in
the public domain on June 15, 1991, by its author,
Edward K. Ream
166 North Prospect Ave.
Madison, WI 53705.
(608) 257-0802
Sherlock may be used for any commercial or non-commercial purpose.
DISCLAIMER OF WARRANTIES
Edward K. Ream (Ream) specifically disclaims all warranties,
expressed or implied, with respect to this computer software,
including but not limited to implied warranties of merchantability
and fitness for a particular purpose. In no event shall Ream be
liable for any loss of profit or any commercial damage, including
but not limited to special, incidental consequential or other damages.
*/
/*
Constants describing limits.
*/
#define MAX_INCLUDE 20 /* Max length of nested includes. */
#define MAX_SYMBOL 600 /* Max len of symbols/strings. */
#define MAX_FILE_NAME 50 /* Maximum length of file names. */
#define MAX_IF 50 /* Max nesting level of #if's. */
#define MAX_PATHS 40 /* Max number of -s args. */
#define MAX_HOLD 1000 /* Max length of holding buffer. */
#define MAX_MAC 100 /* Max depth of macro expansions. */
#define MAX_RTEXT 1000 /* Max chars in replacement string. */
#define MAX_ATEXT 1000 /* Max char in actual args. */
#define MAX_NARGS 50 /* Max number of macro arguments. */
#define MAX_MDEPTH 100 /* Max depth of macro expansions. */
/*
The global struct used to define the macros being currently expanded.
This is NOT the same as the current macro input stream since an
input stream can be exhausted while expanding a macro.
*/
struct x_struct {
char * x_name;
bool x_done;
};
/*
Exclude the rest if glb.c is the lead-in file.
*/
#ifndef no_extern
/*
============= global variables =============
*/
/*
The next character of input.
*/
extern char ch; /* The NEXT character. */
/*
Kludge for expr().
*/
extern bool curly_ok_flag; /* Allow { and } as valid delims. */
/*
User Flags.
*/
extern bool insert_flag; /* TRUE if insert #include "sl.h" */
extern int nest_flag; /* TRUE if comments can nest. */
extern int com_flag; /* TRUE if comments are output. */
extern bool entry_flag; /* TRUE if Sherlock macros on entry. */
extern bool exit_flag; /* TRUE if Sherlock macros on exit. */
extern bool loop_flag; /* TRUE if Sherlock macros in loops. */
extern bool printf_flag; /* TRUE if using printf for output. */
extern bool usr_flag; /* TRUE if using user output routines. */
extern bool tick_flag; /* TRUE if using count statistics only. */
extern bool slc_flag; /* TRUE if single-line comments valid. */
/*
Spellings of macros generated by SPP.
*/
extern char * mn_tab[];
extern char * r_bool;
extern char * r_char;
extern char * r_double;
extern char * r_float;
extern char * r_int;
extern char * r_long;
extern char * r_ptr;
extern char * r_string;
extern char * r_uint;
extern char * r_ulong;
extern char * r_void;
extern char * s_clear; /* 2/16/89 */
extern char * s_init;
extern char * s_parse;
extern char * s_disable; /* 2/16/89 */
extern char * tick;
extern char * tickb;
extern char * tickx;
extern char * pbtrace;
extern char * ptrace;
/*
Globals for macro expansion.
p_rescan, m_flag are used by sysnext().
*/
extern bool m_flag; /* TRUE if expanding a macro. */
extern char macro_buf[MAX_RTEXT]; /* Final macro buffer. */
extern char * p_rescan; /* Pointer into rescan_buf[]. */
/*
White space and held output.
*/
extern char hws_buf [MAX_HOLD]; /* Held white space. */
extern int hws_count; /* Count of held white space. */
extern char hold_buf [MAX_HOLD]; /* Held non-white space. */
extern int hold_count;
extern bool hold_flag; /* TRUE if holding characters. */
extern int ch_hold; /* TRUE if ch should be buffered. */
extern char lws_buf [100]; /* Leading white space buffer. */
extern int lws_count; /* Leading white space count. */
extern int cnl_count; /* Consecutive newline count. */
extern int last_tok; /* Previous token. */
extern int last_ch; /* Last char. */
extern bool first_tok; /* True if token is first in line. */
extern bool con_flag; /* True if in PP constant expr. */
extern bool m_flag; /* TRUE if expanding a macro. */
/*
The name of the current function, or NULL.
*/
extern char * fn_name;
/*
Globals describing tokens.
The code assumes that no token or string will ever be longer than
MAX_SYMBOL. If that ever is not so the program may crash. Thus,
MAX_SYMBOL should be very large -- say 1000 or more.
*/
extern en_tokens token; /* The current token. */
extern int t_subtype; /* The subtype of token class. */
extern char t_symbol [MAX_SYMBOL]; /* The spelling of the token. */
extern int t_length; /* The length of the token (in the text)*/
extern long t_value; /* Value of integer constants. */
/*
The following globals are set ONLY by the system module and
used by the preprocessor.
*/
extern char * t_file; /* Name of current input file. */
extern int t_line; /* Line number within file. */
extern int t_inlevel; /* Current input file level. */
/*
Globals for use internally to the token routines.
*/
extern bool t_ifstack [MAX_IF]; /* Stack for nexted #if's */
extern int t_iflevel; /* Nexting depth of #if's */
extern long t_errcount; /* Number of errors seen. */
/*
Defines for the path table.
This table is used to search for #include files.
*/
extern char * paths [MAX_PATHS]; /* Pointers to path names. */
extern int n_paths; /* Number of paths defined. */
#endif /* no_extern */